home *** CD-ROM | disk | FTP | other *** search
- From: kanze@gabi-soft.fr (J. Kanze)
- Message-ID: <KANZE.96Mar14132720@gabi.gabi-soft.fr>
- X-Original-Date: 14 Mar 1996 12:27:20 GMT
- Path: in2.uu.net!bounce-back
- Date: 14 Mar 96 15:23:50 GMT
- Approved: fjh@cs.mu.oz.au
- Return-Path: <daemon@meeker.UCAR.EDU>
- Newsgroups: comp.std.c++
- Subject: Re: Implementation of class basic_string<class charT, class traits, class Allocator>
- Organization: GABI Software, Sarl.
- References: <3147413B.B10@trcinc.com>
- In-Reply-To: Rich Paul's message of 13 Mar 96 23:46:01 GMT
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMUg6EOEDnX0m9pzZAQFGQAF9FlBshla3FR5KsZvx/Nuti2vOXVlvjkBV
- BW2XUkjV4oyTvhfmaDBP+Tt1ovcx/ezY
- =ZLnP
-
- In article <3147413B.B10@trcinc.com> Rich Paul <rpaul@trcinc.com>
- writes:
-
- |> I am currently implementing, from the working paper, class
- |> basic_string. I'm not sure on a couple of things. The first is
- |> if the standard says:
-
- |> insert ( const basic_string bs&str )
- |> Does this and that
- |> insert ( charT *cp )
- |> insert ( basic_string ( cp );
-
- |> am I non-complient if I put the real code in the charT* overload
- |> and have the other call it? I'm not sure the level of
- |> complience that is required ...
-
- At the most, only the externally observable behavior counts. How you
- implement the functions is your business. (In some cases, certain
- variations in the externally observable behavior are also allowed.)
-
- |> Also, is there a validation suite that can put this class
- |> through it's paces?
-
- Is there a compiler which will compile it if it is complete?
-
- |> One more thing ... before calling traits::deallocate, should I
- |> explicitly call destructors on the charT's in my array, since it
- |> may be a class type, or does the definition of charT as being
- |> 'char-like' preclude this?
-
- Good question. In my implementation, I suppose that charT must have a
- trivial constructor and destructor, but that is largely because of
- laziness on my part; I know of nothing in the standard to support this.
-
- Note that the destructors are not the only problem: you also need the
- constructors. More important, when inserting into the stream (and thus
- shifting data up), you have to be careful to use the constructor on raw
- memory, but assignment on memory that has already been constructed.
- Typically, this will mean that you will have to use uninitialized_copy
- for part of the shift, and copy_backward for the other.
- --
- James Kanze (+33) 88 14 49 00 email: kanze@gabi-soft.fr
- GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
- Conseils, itudes et rialisations en logiciel orienti objet --
- -- A la recherche d'une activiti dans une region francophone
- ---
- [ comp.std.c++ is moderated. To submit articles: try just posting with ]
- [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
- [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
- [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
- [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
-